package filter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;

import pojo.User;

public class LoginCheck extends HandlerInterceptorAdapter {


	@Override
	public boolean preHandle(HttpServletRequest request, HttpServletResponse response,
			Object arg2) throws Exception {
		User user=(User) request.getSession().getAttribute("loginUser");
		if(user==null){
			response.sendRedirect(request.getContextPath()+"/login");
			return false;
		}
		return true;
	}

}
